﻿namespace LuckyAssetManagerContrib
{
	using System;
	using System.Configuration;

	using Lucky.AssetManager.Configuration;

	using Configuration;
	using FileCache;

	/// <summary>
	/// Asset manager context
	/// </summary>
	public static class AssetManagerContext
	{
		private static readonly Lazy<AssetManagerSettings> _configuration =
			new Lazy<AssetManagerSettings>(() =>
				(AssetManagerSettings)ConfigurationManager.GetSection("lucky/assetManager"));
		/// <summary>
		/// Configuration settings of asset manager
		/// </summary>
		public static AssetManagerSettings Configuration
		{
			get
			{
				return _configuration.Value;
			}
		}

		private static readonly Lazy<AssetManagerContribSettings> _contribConfiguration = 
			new Lazy<AssetManagerContribSettings>(() =>
				(AssetManagerContribSettings)ConfigurationManager.GetSection("luckyAssetManagerContrib"));
		/// <summary>
		/// Configuration settings of asset manager contrib
		/// </summary>
		public static AssetManagerContribSettings ContribConfiguration
		{
			get
			{
				return _contribConfiguration.Value;
			}
		}

		private static readonly Lazy<AssetFileCacheManager> _fileCacheManager = 
			new Lazy<AssetFileCacheManager>(() => new AssetFileCacheManager());
		/// <summary>
		/// File cache manager
		/// </summary>
		public static AssetFileCacheManager FileCacheManager
		{
			get
			{
				return _fileCacheManager.Value;
			}
		}
	}
}
